package com.bw.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.bw.util.TaskException;
import com.bw.domain.SysJob;
import com.baomidou.mybatisplus.extension.service.IService;
import org.quartz.SchedulerException;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
* @author xiaoabiao
* @description 针对表【sys_job(定时任务调度表)】的数据库操作Service
* @createDate 2023-08-15 15:55:26
*/
public interface SysJobService extends IService<SysJob> {


    IPage<SysJob> selectPageVo(IPage<?> page, SysJob sysJob);


    List<SysJob> selectJobList(SysJob sysJob);

    /**
     * 新增任务
     *
     * @param job 调度信息
     * @return 结果
     */
    int inserts(SysJob sysJob) throws SchedulerException, TaskException;

    int updateJob(SysJob sysJob) throws SchedulerException, TaskException;

    SysJob getByIds(Long id);//123
    /**
     * 任务调度状态修改
     *
     * @param job 调度信息
     * @return 结果
     */
    int updatestatus(SysJob byId) throws SchedulerException;
    /**
     * 恢复任务
     *
     * @param job 调度信息
     * @return 结果
     */
    public int resumeJob(SysJob job) throws SchedulerException;
    /**
     * 暂停任务
     *
     * @param job 调度信息
     */
    public int pauseJob(SysJob job) throws SchedulerException;

    /**
     * 删除任务
     *
     * @param job 调度信息
     */
    void delJobByIds(String[] split) throws SchedulerException;
    /**
     * 删除任务后，所对应的trigger也将被删除
     *
     * @param job 调度信息
     */
    public int deleteJob(SysJob job) throws SchedulerException;

    void run(SysJob sysJob) throws SchedulerException;
}
